<?php

namespace App\Http\Controllers\Utils;

use Illuminate\Support\Facades\Validator;
use phpDocumentor\Reflection\Types\This;

/**
 *
 */
class ValidatorFactory
{

    /**
     * normal error message
     * @var array
     */
    private static $ErrorMessage = [

    ];

    /**
     * normal validator fields rules
     * @var array
     */
    private static $Rules = [

    ];

    /**
     * @param $fields need validator array
     * @param $rules custom validator fields rules
     * @param $errorMessage custom error messae
     * @return \Illuminate\Contracts\Validation\Validator
     */
    public static function validate($fields, $rules = null, $errorMessage = null): \Illuminate\Contracts\Validation\Validator
    {
        return Validator::make($fields,$rules==null ? self::$Rules : $rules,$errorMessage == null ? self::$ErrorMessage : $errorMessage);
    }

}
